package com.bit.cfdi.web.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.bit.cfdi.web.dao.TelefonoDAO;
import com.bit.cfdi.web.domain.Contacto;
import com.bit.cfdi.web.domain.Telefono;
@Service
public class TelefonoService {

	@Autowired TelefonoDAO telefonoDAO;
	
	public void save(Telefono telefono) throws DataAccessException {
		telefonoDAO.save(telefono);
	}

	public Telefono getById(Long id) throws DataAccessException {
		return telefonoDAO.getById(id);
	}

	public List<Telefono> getAll() throws DataAccessException {
		return telefonoDAO.getAll();
	}
	
	public List<Telefono> getByContacto(final Contacto contacto) 
			throws DataAccessException {
		
		return telefonoDAO.getByContacto(contacto);
	}

	public void deleteFromContacto(final Contacto contacto) 
			throws DataAccessException {
		
		telefonoDAO.deleteFromContacto(contacto);
	}
	
}
